#include "junix.h"
using namespace std;

int main(int argc, char **argv)
{
	srand(time(0));
	vector<int> V(20);

	generate(V.begin(),V.end(),
			boost::bind( modulus<int>(),
				boost::bind(rand), 20));

	ostream_iterator<int> oit(cout, " ");
	copy(V.begin(),V.end(),oit);
	cout<<endl;
	//sort(V.begin(),V.end());

	replace_copy(V.begin(), V.end(), oit,4,999);
	copy(V.begin(),V.end(),oit);
	cout<<endl;

	replace_copy_if(V.begin(),V.end(),oit,
			boost::bind( equal_to<int>(),
				boost::bind( modulus<int>(), _1, 5), 0),8888);
	cout<<endl;
}
